package com.zhiyi.coco.service.impl;

import com.zhiyi.coco.dao.FoodInfoMapper;
import com.zhiyi.coco.entity.FoodInfo;
import com.zhiyi.coco.service.FoodInfoService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
@Log4j
public class FoodInfoServiceImpl implements FoodInfoService {
    @Autowired
    private FoodInfoMapper mapper;

    @Override
    public List<FoodInfo> getAll(Integer typeId) {
        return mapper.getAll(typeId);
    }

    @Override
    public Integer deleteInfoById(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public Integer updateimgbyid(Integer id) {
        return mapper.updateimgbyid(id);
    }

    @Override
    public Integer updateByPrimaryKey(FoodInfo foodInfo) {
        return mapper.updateByPrimaryKey(foodInfo);
    }

    @Override
    public Integer insert(FoodInfo foodInfo) {
        return mapper.insertSelective(foodInfo);
    }

    @Override
    public FoodInfo selectFid(String name) {
        return mapper.selectFid(name);
    }

    @Override
    public Integer updateFid(String name, Integer re) {
        return mapper.updateFid(name,re);
    }

    @Override
    public FoodInfo getInfoById(Integer id) {
        return mapper.getInfoById(id);
    }

    @Override
    public List<FoodInfo> getAllNoParam() {
        return mapper.getAllNoParam();
    }
}
